package demo1;
class OuterClass{
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;
    class InnerClass{
        public int data1 = 111;
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;
        public void test(){
            System.out.println(data1);//111
            System.out.println(this.data1);//111
            //当外部类数据成员和内部类中的数据成员一样的时候 访问外部成员OuterClass.this.
            //实力内部类当中，是包含外部类的this的
            System.out.println(OuterClass.this.data1);//1

            System.out.println(data4);
            System.out.println(data5);
            System.out.println("内部类的test方法");
        }
    }
    public void test(){
        System.out.println("外部类的test方法");
    }
}
public class Test2 {
    public static void main(String[] args) {
        OuterClass outerClsss = new OuterClass();
       // System.out.println(outerClsss.data1);
        OuterClass.InnerClass innerClass1 = outerClsss.new InnerClass();
        OuterClass.InnerClass innerClass2 = new OuterClass().new InnerClass();
        innerClass1.test();
        //innerClass2.test();
    }
}
